import request from '@/utils/request'

// 查询追溯详情列表
export function listTraceDetail(query) {
  return request({
    url: '/mes/traceability/detail/list',
    method: 'get',
    params: query
  })
}

// 查询追溯详情
export function getTraceDetail(detailId) {
  return request({
    url: '/mes/traceability/detail/' + detailId,
    method: 'get'
  })
}

// 新增追溯详情
export function addTraceDetail(data) {
  return request({
    url: '/mes/traceability/detail',
    method: 'post',
    data: data
  })
}

// 修改追溯详情
export function updateTraceDetail(data) {
  return request({
    url: '/mes/traceability/detail',
    method: 'put',
    data: data
  })
}

// 删除追溯详情
export function delTraceDetail(detailId) {
  return request({
    url: '/mes/traceability/detail/' + detailId,
    method: 'delete'
  })
}

// 根据追溯ID查询详情列表
export function getDetailsByTraceId(traceId) {
  return request({
    url: '/mes/traceability/detail/trace/' + traceId,
    method: 'get'
  })
}

// 根据父节点ID查询子节点
export function getDetailsByParentId(parentId) {
  return request({
    url: '/mes/traceability/detail/parent/' + parentId,
    method: 'get'
  })
}

// 批量新增追溯详情
export function batchInsertTraceDetail(data) {
  return request({
    url: '/mes/traceability/detail/batch',
    method: 'post',
    data: data
  })
}